package com.poly.polyparameter_;

public class Polyparameter {
    public static void main(String[] args) {
        Worker tom = new Worker("Tom", 2500);
        Manager milan = new Manager("Milan", 5000, 200000);

        Polyparameter polyparameter = new Polyparameter();
        polyparameter.showEmpAnnual(tom);

        polyparameter.showEmpAnnual(milan);

        polyparameter.testWork(tom);
        polyparameter.testWork(milan);

    }
    public void showEmpAnnual(Employee e) {
        System.out.println(e.getAnnual());
    }
    public void testWork (Employee e) {
        if (e instanceof Worker) {
            ((Worker)e).work();
        } else if (e instanceof Manager) {
            ((Manager)e).Manage();
        } else {
            System.out.println("不必处理");
        }
    }
}

